package components
{
	public class DateTimeRecord
	{
		
		public var sendDateTime:Date;
		public var receiveDateTime:Date;
		public var serverDateTime:Date;
		public var roundTripTime:Number;
		public var latency:Number;
		public var sendServerClientTimeDifference:Number;
		public var receiveServerClientTimeDifference:Number;
		
		public function DateTimeRecord()
		{
			sendDateTime = new Date();
		}
		
		public function update(obj:Object):void{
			receiveDateTime = new Date();
			serverDateTime = obj.date;
		}
		
		public function calculate():void{
			roundTripTime = receiveDateTime.getTime() - sendDateTime.getTime();
			latency = roundTripTime/2;
			sendServerClientTimeDifference = serverDateTime.getTime() - sendDateTime.getTime();
			receiveServerClientTimeDifference = serverDateTime.getTime() - receiveDateTime.getTime();
		}
	}
}